package main

/*
#cgo CFLAGS: -Wall
#cgo CFLAGS: -Icpp
//#cgo LDFLAGS: -L${SRCDIR} -ltest -ldl
#include "cwrap.h"


#include <stdio.h>
#include <stdlib.h>
#include <dlfcn.h>

typedef struct{
	int id;
}ctx;

ctx *createCtx(int id){
	ctx *obj = (ctx *)malloc(sizeof(ctx));
	obj->id = id;
	return obj;
}

void Hello(char *str){
	printf("%s\n", str);
}



*/
import "C"
import (
	"fmt"
	"unsafe"
)

func main() {
	fmt.Println("done...")
	s := "hello"
	cs := C.CString(s)
	C.Hello(cs)
	C.free(unsafe.Pointer(cs))
	fmt.Println("done...")

	var ctx *C.ctx = C.createCtx(100)
	fmt.Printf("id: %d \n", ctx.id)

	C.call()
}
